package com.yuexunit.mobilenurse.module.BloodManage.adapter;

import android.widget.AbsListView;

import com.yuexunit.mobilenurse.R;
import com.yuexunit.mobilenurse.module.BloodManage.bean.BloodBag;

import org.kymjs.kjframe.widget.AdapterHolder;
import org.kymjs.kjframe.widget.KJAdapter;

import java.util.Collection;

/**
 * Created by work-jx on 2017/10/12.
 */
public class BloodBagAdapter extends KJAdapter<BloodBag> {
    public BloodBagAdapter(AbsListView view, Collection<BloodBag> mDatas, int itemLayoutId) {
        super(view, mDatas, itemLayoutId);
    }

    @Override
    public void convert(AdapterHolder helper, BloodBag item, boolean isScrolling, int position) {
        super.convert(helper, item, isScrolling, position);
        helper.setText(R.id.testlist_item_num, "血袋编号:" + item.getHisBagNo());
        helper.setText(R.id.testlist_item_name,item.getBloodKind());
        helper.setText(R.id.testlist_item_unit,item.getBloodNum());
        switch (item.getStatus())
        {
            case 1:
                helper.setText(R.id.testlist_item_statu, "待输血");
                break;
            case 2:
                helper.setText(R.id.testlist_item_statu, "输血中");
                break;
            case 3:
                helper.setText(R.id.testlist_item_statu, "输血完成");
                break;
            case 4:
                helper.setText(R.id.testlist_item_statu, "待接血");
                break;
        }
        if(item.getCancleStatus().equals("-1"))
        {
            helper.setText(R.id.testlist_item_statu, "已退血");
        }
    }
}
